package cn.com.xuxiaowei.config;

import org.springframework.core.NamedThreadLocal;

/**
 * @author xuxiaowei
 */
public class DataSourceContextHolder {

	private static final ThreadLocal<String> CONTEXT_HOLDER = new NamedThreadLocal<>("DataSource");

	public static void setDataSource(String dataSource) {
		CONTEXT_HOLDER.set(dataSource);
	}

	public static String getDataSource() {
		return CONTEXT_HOLDER.get();
	}

	public static void clear() {
		CONTEXT_HOLDER.remove();
	}

}
